import service from "./index.js";
const BASE_URL = '/api';

const responseFormHandle  = (response) => {
    return {
        message: response.msg,
        success: response.code == 200,
        data: response,
    }
}
export const usersLogin = (data) => {
    return service({
        url: `${BASE_URL}/user/login`,
        notAuth: true,
        data: {
            userAccount: data.userAccount,
            password: data.password
        },
        // formRequestSign: true,
        responseFormHandle,
    })
}

// export const usersRegister = (data) => {
//     return service({
//         url: `${BASE_URL}/users/register`,
//         notAuth: true,
//         data: {
//             "userId": data.userId,
//             "userAccount": data.userAccount,
//             "password": data.password,
//             "userName": data.userName,
//             "deptId": data.deptId,
//         },
//     })
// }

// 获取就诊信息
// export const getMedicalVisits = (data) => {
//     return service({
//         url: `${BASE_URL}/medical-visits/by-department/${data.deptName}`,
//         notAuth: true,
//         method: 'get',
        
//     })
// }

// 获取用户列表
export const selectUserList = (data) => {
    return service({
        url: `${BASE_URL}/user/selectUserList`,
        notAuth: true,
        method: 'get',
        params: data,
        // formRequestSign: true,
        responseFormHandle,
        noMessageTip: true,
    })
}
// 创建用户
export const registerUser = (data) => {
    return service({
        url: `${BASE_URL}/user/register`,
        notAuth: true,
        data,
        // formRequestSign: true,
        responseFormHandle,
        noMessageTip: false, // 是否不展示成功提示
    })
}
// 更新用户
export const updateUser = (data) => {
    return service({
        url: `${BASE_URL}/user/update`,
        notAuth: true,
        data,
        // formRequestSign: true,
        responseFormHandle,
        noMessageTip: false, // 是否不展示成功提示
    })
}
// 删除用户
export const deleteUser = (data) => {
    return service({
        url: `${BASE_URL}/user/delete`,
        notAuth: true,
        data,
        // formRequestSign: true,
        responseFormHandle,
        noMessageTip: false, // 是否不展示成功提示
    })
}
// 重置密码
export const resetPassWord = (data) => {
    return service({
        url: `${BASE_URL}/user/resetPassWord`,
        notAuth: true,
        data,
        // formRequestSign: true,
        responseFormHandle,
        noMessageTip: false, // 是否不展示成功提示
    })
}
// 获取科室列表
export const selectDeptList = (data) => {
    return service({
        url: `${BASE_URL}/department/list`,
        notAuth: true,
        data,
        // formRequestSign: true,
        responseFormHandle,
        noMessageTip: true,
    })
}
export const createDepartment = (data) => {
    return service({
        url: `${BASE_URL}/department/create`,
        notAuth: true,
        data,
        // formRequestSign: true,
        responseFormHandle,
        noMessageTip: true,
    })
}
export const updateDepartment = (data) => {
    return service({
        url: `${BASE_URL}/department/update`,
        notAuth: true,
        data,
        // formRequestSign: true,
        responseFormHandle,
        noMessageTip: true,
    })
}
export const deleteDepartment = (data) => {
    return service({
        url: `${BASE_URL}/department/delete`,
        notAuth: true,
        data,
        // formRequestSign: true,
        responseFormHandle,
        noMessageTip: true,
    })
}

// 获取角色列表
export const selectRoleList = (data) => {
    return service({
        url: `${BASE_URL}/role/list`,
        notAuth: true,
        data,
        // formRequestSign: true,
        responseFormHandle,
        noMessageTip: true,
    })
}

// 获取诊断字典列表
export const selectDiagnosisDictList = (data) => {
    return service({
        url: `${BASE_URL}/diagnosisDict/list`,
        notAuth: true,
        data,
        responseFormHandle,
        noMessageTip: true,
    })
}

// 创建诊断字典
export const createDiagnosisDict = (data) => {
    return service({
        url: `${BASE_URL}/diagnosisDict/create`,
        notAuth: true,
        data,
        responseFormHandle,
        noMessageTip: false,
    })
}

// 更新诊断字典
export const updateDiagnosisDict = (data) => {
    return service({
        url: `${BASE_URL}/diagnosisDict/update`,
        notAuth: true,
        data,
        responseFormHandle,
        noMessageTip: false,
    })
}

// 删除诊断字典
export const deleteDiagnosisDict = (data) => {
    return service({
        url: `${BASE_URL}/diagnosisDict/delete`,
        notAuth: true,
        data,
        responseFormHandle,
        noMessageTip: false,
    })
}

// 获取医嘱字典列表
export const selectOrderItemDictList = (data) => {
    return service({
        url: `${BASE_URL}/orderItemDict/list`,
        notAuth: true,
        data,
        responseFormHandle,
        noMessageTip: true,
    })
}

// 创建医嘱字典
export const createOrderItemDict = (data) => {
    return service({
        url: `${BASE_URL}/orderItemDict/create`,
        notAuth: true,
        data,
        responseFormHandle,
        noMessageTip: false,
    })
}

// 更新医嘱字典
export const updateOrderItemDict = (data) => {
    return service({
        url: `${BASE_URL}/orderItemDict/update`,
        notAuth: true,
        data,
        responseFormHandle,
        noMessageTip: false,
    })
}

// 删除医嘱字典
export const deleteOrderItemDict = (data) => {
    return service({
        url: `${BASE_URL}/orderItemDict/delete`,
        notAuth: true,
        data,
        responseFormHandle,
        noMessageTip: false,
    })
}

// 获取患者列表
export const selectPatientList = (data) => {
    return service({
        url: `${BASE_URL}/patient/list`,
        method: 'post',
        data,
        responseFormHandle,
        noMessageTip: true,
    })
}

// 创建患者
export const createPatient = (data) => {
    return service({
        url: `${BASE_URL}/patient/create`,
        method: 'post',
        data,
        responseFormHandle,
    })
}

// 更新患者
export const updatePatient = (data) => {
    return service({
        url: `${BASE_URL}/patient/update`,
        method: 'post',
        data,
        responseFormHandle,
    })
}

// 删除患者
export const deletePatient = (data) => {
    return service({
        url: `${BASE_URL}/patient/delete`,
        method: 'post',
        data,
        responseFormHandle,
    })
}

// 添加生命体征
export const addPatientVitalSigns = (data) => {
    return service({
        url: `${BASE_URL}/patientVitalSigns/addPatientVitalSigns`,
        method: 'post',
        data,
        responseFormHandle,
    })
}

// 获取就诊列表
export const selectVisitList = (data) => {
    return service({
        url: `${BASE_URL}/visit/list`,
        method: 'post',
        data,
        responseFormHandle,
        noMessageTip: true
    })
}

// 创建就诊
export const createVisit = (data) => {
    return service({
        url: `${BASE_URL}/visit/create`,
        method: 'post',
        data,
        responseFormHandle,
    })
}

// 更新就诊
export const updateVisit = (data) => {
    return service({
        url: `${BASE_URL}/visit/update`,
        method: 'post',
        data,
        responseFormHandle,
    })
}

// 删除就诊
export const deleteVisit = (data) => {
    return service({
        url: `${BASE_URL}/visit/delete`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
// 获取医生就诊列表
export const getPatientsView = (data) => {
    return service({
        url: `${BASE_URL}/visit/getPatientsView`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
// 获取患者体征信息
export const selectPatientVitalSignsByPatientId = (data) => {
    return service({
        url: `${BASE_URL}/patientVitalSigns/selectPatientVitalSignsByPatientId`,
        method: 'get',
        params: data,
        responseFormHandle,
        noMessageTip: true
    })
}
export const getDiagnosisList = (data) => {
    return service({
        url: `${BASE_URL}/diagnosis/list`,
        method: 'post',
        data,
        responseFormHandle,
        noMessageTip: true
    })
}
export const diagnosisAdd = (data) => {
    return service({
        url: `${BASE_URL}/diagnosis/add`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
export const diagnosisUpdate = (data) => {
    return service({
        url: `${BASE_URL}/diagnosis/update`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
export const diagnosisDelete= (data) => {
    return service({
        url: `${BASE_URL}/diagnosis/delete`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
// 医嘱
export const getMedicalOrderList = (data) => {
    return service({
        url: `${BASE_URL}/medicalOrder/list`,
        method: 'post',
        data,
        responseFormHandle,
        noMessageTip: true
    })
}
export const medicalOrderAdd = (data) => {
    return service({
        url: `${BASE_URL}/medicalOrder/create`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
export const medicalOrderUpdate = (data) => {
    return service({
        url: `${BASE_URL}/medicalOrder/update`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
export const medicalOrderDelete= (data) => {
    return service({
        url: `${BASE_URL}/medicalOrder/delete`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
// 病历127.0.0.1:8080/medicalRecord/create
export const getMedicalRecordList = (data) => {
    return service({
        url: `${BASE_URL}/medicalRecord/list`,
        method: 'post',
        data,
        responseFormHandle,
        noMessageTip: true
    })
}
export const medicalRecordAdd = (data) => {
    return service({
        url: `${BASE_URL}/medicalRecord/create`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
export const medicalRecordUpdate = (data) => {
    return service({
        url: `${BASE_URL}/medicalRecord/update`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
export const medicalRecordDelete= (data) => {
    return service({
        url: `${BASE_URL}/medicalRecord/delete`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
export const medicalRecordSave= (data) => {
    return service({
        url: `${BASE_URL}/medicalRecord/save`,
        method: 'post',
        data,
        responseFormHandle,
    })
}

// 医技管理
export const getExamList= (data) => {
    return service({
        url: `${BASE_URL}/medicalOrder/ExamLis/list`,
        method: 'post',
        data,
        responseFormHandle,
        noMessageTip: true

    })
}
// 保存报告
export const uploadImage= (data) => {
    return service({
        url: `${BASE_URL}/examReport/uploadImage`,
        method: 'post',
        data,
        responseFormHandle,
    })
}
// 非医技管理
export const getNoExamList= (data) => {
    return service({
        url: `${BASE_URL}/medicalOrder/nonExamLis/list`,
        method: 'post',
        data,
        responseFormHandle,
        noMessageTip: true

    })
}

// 操作日志
export const getOperlogList = (data) => {
    return service({
        url: `${BASE_URL}/operlog/list`,
        method: 'get',
        params: data,
        responseFormHandle,
        noMessageTip: true
    })
}

// 角色相关权限接口
// 获取权限树
export const getPermissionTree = (data) => {
    return service({
        url: `${BASE_URL}/permission/getPermissionTree`,
        data,
        responseFormHandle,
        noMessageTip: true,
    })
}
// 查询角色权限明细
export const selectRolePermissionList = (data) => {
    return service({
        url: `${BASE_URL}/role/selectRolePermissionList`,
        data,
        responseFormHandle,
        noMessageTip: true,
    })
}
// 分配角色权限
export const assignRolePermissions = (data) => {
    return service({
        url: `${BASE_URL}/role/assignPermissions`,
        data,
        responseFormHandle,
        noMessageTip: false,
    })
}
// 创建角色
export const createRole = (data) => {
    return service({
        url: `${BASE_URL}/role/create`,
        data,
        responseFormHandle,
        noMessageTip: false,
    })
}
// 更新角色
export const updateRole = (data) => {
    return service({
        url: `${BASE_URL}/role/update`,
        data,
        responseFormHandle,
        noMessageTip: false,
    })
}
// 删除角色
export const deleteRole = (data) => {
    return service({
        url: `${BASE_URL}/role/delete`,
        data,
        responseFormHandle,
        noMessageTip: false,
    })
}